<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
        }
        dl{
            width: 150px;
            margin: 50px auto;
            text-align: center;
        }
        dt{
            line-height: 50px;
            background-color: rgb(60, 125, 146);
            color: #fff;
            margin-top: 10px;
            cursor: pointer;
        }
        dd{
            background-color: rgb(54, 94, 54);
            color: #fff;
            line-height: 30px;

            display: none;
        }
    </style>
</head>
<body>

    <dl>
        <dt>水果</dt>
        <dd>苹果</dd>
        <dd>香蕉</dd>
        <dd>栗子</dd>
        <dd>梨子</dd>

        <dt>蔬菜</dt>
        <dd>白菜</dd>
        <dd>青菜</dd>
        <dd>香菜</dd>
        <dd>花菜</dd>

        <dt>肉类</dt>
        <dd>猪肉</dd>
        <dd>羊肉</dd>
        <dd>牛肉</dd>
        <dd>小强</dd>
    </dl>

    <script src="jquery.js"></script>
    <script>
        /*
        需求：点击一级菜单dt
            1.切换对应的二级菜单
            2.隐藏其他的二级菜单
          */
         $('dt').on('click',function(){
             //切换对应的二级菜单
             $(this).nextUntil('dt').slideToggle(2000)
             //隐藏其他二级菜单
             $(this).siblings('dt').nextUntil('dt').slideUp(2000)
         })
    </script>
</body>
</html>